import React from 'react'
import { InputItem, Button, WhiteSpace } from 'antd-mobile'
import PropTypes from 'prop-types';
import CommonHeader from 'COMPONENT/CommonHeader';
import './index.less'
// ========================================
class Mine extends React.Component {
    static contextTypes = {
        router: PropTypes.object.isRequired
    };
    constructor (props) {
        super(props);
        this.state = {
            ctype: '',
            code: '93939385'
        };
    }
    componentWillMount () {
        // console.log('this.props.location:', this.props.location);
        let ctype = this.props.location.state.ctype;
        this.setState({
            ctype
        });
    }
    render() {
        let that = this;
        return (
            <div id="creditCode">
                <CommonHeader
                    name={!this.state.ctype ? '个人征信查询和使用授权' : '个人房屋查询和使用授权'}
                    leftContentTitle="@back"
                />
                <div style={{paddingTop: '50px'}}>
                    <InputItem placeholder="编号" editable={false}
                               value={this.state.code}
                               onChange={ val => {this.setState({code: val})} }>
                        {!this.state.ctype ? '征信授权编号：' : '房查授权编号：'}
                    </InputItem>
                </div>
                <WhiteSpace size="lg" />
                <WhiteSpace size="lg" />
                <div className="btnGroup-one">
                    <Button type="primary" className="btnGroup-one-btn"
                            onClick={() => {
                                that.context.router.push({
                                    pathname: '/Mine'
                                });
                            }}
                    >返回</Button>
                </div>
            </div>
        );
    }
}
// ========================================
export default Mine;